<script setup lang="ts">
import { defineProps } from "vue";

defineProps<{
  data: any;
}>();
</script>

<template>
  <div class="vuln-cards">
    <el-card shadow="hover" class="vuln-card-item critical">
      <div class="vuln-card-content">
        <div class="vuln-number">{{ data.total_vulnerabilities || 0 }}</div>
        <div class="vuln-label">漏洞总数</div>
      </div>
    </el-card>

    <el-card shadow="hover" class="vuln-card-item high">
      <div class="vuln-card-content">
        <div class="vuln-number">{{ data.total_vulnerable_ips || 0 }}</div>
        <div class="vuln-label">存在漏洞的IP</div>
        <div class="vuln-percentage">
          {{ data.vulnerability_ip_percentage || 0 }}%
        </div>
      </div>
    </el-card>

    <el-card shadow="hover" class="vuln-card-item critical-vuln">
      <div class="vuln-card-content">
        <div class="vuln-number">
          {{ data.critical_or_high_or_medium_ips || 0 }}
        </div>
        <div class="vuln-label">严重/高危/中危漏洞IP</div>
        <div class="vuln-percentage">
          {{ data.critical_or_high_or_medium_percentage || 0 }}%
        </div>
      </div>
    </el-card>
  </div>
</template>

<style lang="scss" scoped>
.vuln-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.vuln-card-item {
  border-left: 4px solid;
  transition: all 0.3s;

  &.critical {
    border-left-color: #8b0000;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
  }

  &.high {
    border-left-color: #ff0000;
    background: linear-gradient(135deg, #fff8f0 0%, #fff0e8 100%);
  }

  &.critical-vuln {
    border-left-color: #f5222d;
    background: linear-gradient(135deg, #fff0f6 0%, #ffeef7 100%);
  }

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

.vuln-card-content {
  text-align: center;
  padding: 8px 0;
}

.vuln-number {
  font-size: 32px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 8px;
}

.vuln-label {
  font-size: 14px;
  color: #606266;
  margin-bottom: 4px;
}

.vuln-percentage {
  font-size: 18px;
  font-weight: 600;
  color: #f5222d;
}
</style>
